{template 'header', 'index'}
<div class="main">
  <h2 class="pubtitle"><span>会员注册</span>
    <div class="c"></div>
  </h2>
  <div class="msg message f14"><span class="green f14">填写帐号信息</span>&nbsp;»&nbsp;<span class="f14 aaa">注册成功</span></div>
  <div class="table-form" style="border-right:1px solid #E5E5E5; width:700px;float:left;">
    <form action="?m=member&c=index&a=register" method="post" name="myform" id="myform">
      <div class="inputbox">
        <label class="t">用户名：</label>
        <input type="text" class="input" name="info[username]" id="username" size="36" />
      </div>
      <div class="inputbox">
        <label class="t">密&nbsp;码：</label>
        <input type="password" class="input" name="info[password1]" id="password1" size="36" />
      </div>
      <div class="inputbox">
        <label class="t">确认密码：</label>
        <input type="password" class="input" name="info[password2]" id="password2" size="36" />
      </div>
      <div class="inputbox">
        <label class="t">E-mail：</label>
        <input type="text" class="input" name="info[email]" id="email" size="36" />
      </div>
      <div class="inputbox">
        <label class="t">昵&nbsp;称：</label>
        <input type="text" class="input" name="info[nickname]" id="nickname" size="36" />
      </div>
      <div class="inputbox">
        <label class="t">验证码：</label>
        <input type="text" class="input" name="info[captcha]" id="captcha" size="10" />
        <img onclick="javascript:this.src='?m=api&a=captcha&_' + new Date().getTime()" src="?m=api&a=captcha" title="看不清楚？换一张" style="display: inline; vertical-align:middle; cursor:pointer"> </div>
      <div class="inputbox">
        <label class="t">&nbsp;</label>
        <input type="checkbox" name="protocol" id="protocol" value="1" />
        <label for="protocol" onclick="show_protocol();return false;">阅读并同意注册协议</label>
      </div>
      <div class="inputbox">
        <label class="t">&nbsp;</label>
        <input type="submit" class="btn2" name="dosubmit" id="dosubmit" value="同意注册协议，提交注册" />
      </div>
    </form>
  </div>
  <div style="float:left;padding:10px 0 0 30px;">
    <p class="f14" style="margin-bottom:10px;">已经有帐号了？<br />
      请直接登录</p>
    <input type="button" class="btn2" value="登录" onclick="window.location.href='?m=member&c=index&a=login'" />
  </div>
  <div class="c"></div>
</div>
{template 'footer', 'index'}
<link href="{CSS_PATH}dialog.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="{JS_PATH}dialog.js?_=0515"></script> 
<script type="text/javascript" src="{JS_PATH}formvalidatorregex.js?_=0514"></script> 
<script type="text/javascript" src="{JS_PATH}formvalidator.js?_=0514"></script> 
<script type="text/javascript">
$(function()
{
	$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
	$('#username').formValidator({onshow:"请输入用户名。", onfocus:"用户名应该为3-20位之间，数字字母下划线组成。"}).inputValidator({min:3,max:20,onerror:"用户名应该为3-20位之间，数字字母下划线组成。"}).regexValidator({regexp:"username",datatype:"enum",onerror:"用户名格式错误"}).ajaxValidator({
		type : "get",
		url : "",
		data :"m=member&c=index&a=check_username_ajax",
		datatype : "html",
		async:'false',
		success : function(data){return data == "1" ?  true : false;},
		buttons: $("#dosubmit"),
		onerror : "用户名已存在",
		onwait : "请稍候..."
	});
	$("#password1").formValidator({onshow:"密码应该为3-16位之间。",onfocus:"密码应该为3-16位之间。"}).inputValidator({min:3,max:20,onerror:"密码应该为3-16位之间"});
	$("#password2").formValidator({onshow:"请输入两次密码相同。",onfocus:"请输入两次密码相同。",oncorrect:"密码输入一致"}).compareValidator({desid:"password1",operateor:"=",onerror:"请输入两次密码相同。"});
	$('#nickname').formValidator({empty:true, onshow:'请输入昵称', onfocus:"昵称为3-20位之间，汉字数字字母下划线组成", onempty:'输入昵称为空', oncorrect:'昵称输入正确'}).inputValidator({min:3, max:20, onerror:'昵称为3-20位之间，汉字数字字母下划线组成'}).regexValidator({regexp:"ps_username",datatype:"enum",onerror:"昵称格式错误"}).ajaxValidator({
		type : "get",
		url : "",
		data :"m=member&c=index&a=check_nickname_ajax",
		datatype : "html",
		async:'false',
		success : function(data){return data == "1" ?  true : false;},
		buttons: $("#dosubmit"),
		onerror : "昵称已存在",
		onwait : "请稍候..."
	}).defaultPassed();
	$("#email").formValidator({onshow:"请输入E-mail",onfocus:"请输入E-mail",oncorrect:"E-mail输入正确"}).regexValidator({regexp:"email",datatype:"enum",onerror:"E-mail格式错误"}).ajaxValidator({
		type : "get",
		url : "",
		data :"m=member&c=index&a=check_email_ajax",
		datatype : "html",
		async:'false',
		success : function(data){return data == "1" ?  true : false;},
		buttons: $("#dosubmit"),
		onerror : "邮箱已经被注册了",
		onwait : "请稍候..."
	});
	$('#captcha').formValidator({onshow:'请输入验证码', onfocus:'请输入验证码', oncorrect:'验证码输入正确'}).inputValidator({min:4, max:4, onerror:'验证码输入不正确'}).ajaxValidator({
		type : 'get',
		url :'',
		data :"m=api&a=check_captcha_ajax",
		datatype : "html",
		async:'false',
		success : function(data){return data == "1" ?  true : false;},
		buttons: $("#dosubmit"),
		onerror : "验证码不正确",
		onwait : "请稍候..."
		});
	$('#protocol').formValidator({onshow:'请阅读注册协议', onfocus:'请阅读注册协议'}).inputValidator({min:1, onerror:'请阅读注册协议'});
});
function show_protocol()
{
	art.dialog({lock:false,
				title:'会员注册协议',
				id:'protocoliframe', 
				iframe:'?m=member&c=index&a=protocol',
				width:'510',
				height:'350',
				yesText:'我同意协议'}, 
				function(){$("#protocol").attr("checked",true);});
} 
</script>